home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-09-22 | 4.5 KB | 139 lines | [TEXT/ttxt] |
-
- ----------------------------------------------------------------------------------
- -- Some 5PM hidden features :
- -- Control-Option in the Settings menu makes appear the Tools Scripting Interface Dlogs
- -- Shift-Option in the Settings menu makes appear the TermKeys Dlog (Term Tools only)
- --
- -- Some short-cuts when editing palettes :
- -- Tab key checks and reformats the script
- -- Enter key saves and closes the script
- -- Shift-double-click on a button makes appear directly its script
- -- Option-Shift-double-click on a button makes appear directly the Font Dlog
- ----------------------------------------------------------------------------------
- On startup
- -- this script starts when launching the application
- End startup
-
-
- ----------------------------------------------------------------------------------
- --
- ----------------------------------------------------------------------------------
- Function GetCommandOutPut cmd, timeOut
- Global glob_Session
-
- Transmit cmd & " ; echo ***\***" & cr in glob_Session
- CollectFrom session glob_Session until "******", timeOut
-
- Return it
- End GetCommandOutPut
-
-
- ----------------------------------------------------------------------------------
- --
- ----------------------------------------------------------------------------------
- On GetCurrDir
- Global glob_CurrDir
- Global glob_DirSize
- Global glob_Session
- Global glob_FileList
- Global glob_NbrOfFiles
- Global glob_StartFile
-
- Set the cursor of 5PM to 4
-
- Get GetCommandOutPut ("/bin/ls -la", 1000)
- If it is not empty then
- Put it into glob_FileList
- End If
-
- Put word 2 of line 2 of glob_FileList into glob_DirSize
- Set the name of button 32577 in palt "LS" to glob_DirSize
-
- Put the number of lines in glob_FileList - 3 into glob_NbrOfFiles
- Set the name of button 30967 in palt "LS" to glob_NbrOfFiles
-
- Get GetCommandOutPut ("pwd", 1000)
- Put line 2 of it into glob_CurrDir
- Put char 2 to 99 of glob_CurrDir into glob_CurrDir
- Set the name of button 20030 in palt "LS" to glob_CurrDir
- Put 1 into glob_StartFile
- End GetCurrDir
-
-
- ----------------------------------------------------------------------------------
- --
- ----------------------------------------------------------------------------------
- On ListFile
- Global glob_CurrDir
- Global glob_FileList
- Global glob_StartFile
- Global glob_NbrOfFiles
-
- Open palette "LS"
- Set the cursor of 5PM to 1000
-
- Set the lockScreen of palt "LS" to true
- Put 0 into whichIcon
- Put glob_StartFile + 24 into endFile
- Repeat with whichFile = glob_StartFile to endFile
- Add 1 to whichIcon
- Put "button #" & whichIcon into aButton
-
- Get line whichFile + 2 of glob_FileList
- If whichFile > glob_NbrOfFiles then
- Set the visible of aButton in palt "LS" to false
- Else
- Put word 9 of it into fileName
- Put word 1 of it into fileType
- Set the name of aButton in palt "LS" to fileName
- If char 2 of fileType is "d" then
- Set the icon of aButton in palt "LS" to 30029
- Else
- If fileType contains "x" then
- Set the icon of aButton in palt "LS" to 30028
- Else
- Set the icon of aButton in palt "LS" to 30030
- End If
- End If
- Set the visible of aButton in palt "LS" to true
- End If
- End Repeat
-
- Set the lockScreen of palt "LS" to false
- Set the cursor of 5PM to 0
- End ListFile
-
-
- ----------------------------------------------------------------------------------
- -- This function will log in to AUX. Pass quiet in orderr to not receive
- -- any warning or error messages on the screen.
- ----------------------------------------------------------------------------------
- Function AUXLogin userID, userPswd, quiet
- Set the cursor of 5PM to 1000
- DoMenu "Open Connection"
-
- Repeat while not isConnOpen ()
- End Repeat
-
- Put matchString ("login:") into match
- Put waitForMatch (360) into foundMatch
- If foundMatch is not match then
- If not quiet then
- Answer "Did not manage to connect to AUX"
- End If
- Put false into areLoggedIn
- Else
- Transmit userID & cr
-
- Put matchString ("Password:") into match
- Put waitForMatch (60) into foundMatch
- If foundMatch is match then
- Transmit userPswd & cr
- End If
- Put true into areLoggedIn
- End If
- Set the cursor of 5PM to 0
-
- Return areLoggedIn
- End AUXLogin
-